// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';


/** 参加考试 POST /exam/attend */
export async function attendExam(body: API.ExamAttendParams) {
  return request<{
    data: API.ExamAttendResult[];
  }>('http://localhost:8080/exam/attend', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body
  })
}

/** 获取试卷关联题目信息 GET /exam/view/{examId} */
export async function getExamQuestionInfo(examId: number) {
  return request<{
    data: API.ExamQuestionInfo[];
  }>('http://localhost:8080/exam/view/' + examId, {
    method: 'GET',
  });
}

/** 自动组卷 POST /exam/auto */
export async function getAutoGenerateExam(body: API.AutoGenerateExamParams) {
  return request<{
    data: API.ExamAutoResult;
  }>('http://localhost:8080/exam/auto', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body
  })
}

/** 获取全部试卷 GET /exam/select */
export async function getExamList(options?: { [key: string]: any }) {
  return request<{
    data: API.Exam[];
  }>('http://localhost:8080/exam/select', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 获取全部题目 GET /question/select */
export async function getQuestionList(options?: { [key: string]: any }) {
  return request<{
    data: API.Question[];
  }>('http://localhost:8080/question/select', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 新增题目 POST /question/add */
export async function addQuestion(body: API.QuestionAddParams) {
  return request<{
    data: API.QuestionAddResult;
  }>('http://localhost:8080/question/add', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body
  })
}

/** 新增试卷 POST /exam/add */
export async function addExam(body: API.ExamAddParams) {
  return request<{
    data: API.ExamAddResult;
  }>('http://localhost:8080/exam/add', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body
  });
}

/** 新增题型 POST /question_type/add */
export async function addQuestionType(body: API.QuestionTypeAddParams) {
  return request<{
    data: API.QuestionTypeAddResult;
  }>('http://localhost:8080/question_type/add', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body
  });
}


/** 修改题型 POST /question_type/update */
export async function updateQuestionType(body: API.QuestionTypeUpdateParams) {
  return request<{
    data: API.QuestionTypeUpdateResult;
  }>('http://localhost:8080/question_type/update', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body
  });
}

/** 删除题型 POST /question_type/delete */
export async function deleteQuestionType(body: API.QuestionTypeDeleteParams) {
  return request<{
    data: API.QuestionTypeDeleteResult;
  }>('http://localhost:8080/question_type/delete', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body
  });
}

/** 获取全部题型 GET /question_type/select */
export async function getQuestionTypeList(options?: { [key: string]: any }) {
  return request<{
    data: API.QuestionType[];
  }>('http://localhost:8080/question_type/select', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 获取当前的用户 GET /api/currentUser */
export async function currentUser(options?: { [key: string]: any }) {
  return request<{
    data: API.CurrentUser;
  }>('/api/currentUser', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 退出登录接口 POST /api/login/outLogin */
export async function outLogin(options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/login/outLogin', {
    method: 'POST',
    ...(options || {}),
  });
}

/** 获取当前登录用户接口 POST /user/current */
export async function getCurrentUser(body: API.CurrentUserParams) {
  return request<API.CurrentUserResult>('http://localhost:8080/user/current', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body
  });
}

/** 登录接口 POST /user/login/password */
export async function login(body: API.LoginParams) {
  return request<API.LoginResult>('http://localhost:8080/user/login/password', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body
  });
}

/** 注册接口 POST /user/register */
export async function register(body: API.RegisterParams) {
  return request<API.RegisterResult>('http://localhost:8080/user/register', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body
  });
}
/** 此处后端没有提供注释 GET /api/notices */
export async function getNotices(options?: { [key: string]: any }) {
  return request<API.NoticeIconList>('/api/notices', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 获取规则列表 GET /api/rule */
export async function rule(
  params: {
    // query
    /** 当前的页码 */
    current?: number;
    /** 页面的容量 */
    pageSize?: number;
  },
  options?: { [key: string]: any },
) {
  return request<API.RuleList>('/api/rule', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 更新规则 PUT /api/rule */
export async function updateRule(options?: { [key: string]: any }) {
  return request<API.RuleListItem>('/api/rule', {
    method: 'POST',
    data:{
      method: 'update',
      ...(options || {}),
    }
  });
}

/** 新建规则 POST /api/rule */
export async function addRule(options?: { [key: string]: any }) {
  return request<API.RuleListItem>('/api/rule', {
    method: 'POST',
    data:{
      method: 'post',
      ...(options || {}),
    }
  });
}

/** 删除规则 DELETE /api/rule */
export async function removeRule(options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/rule', {
    method: 'POST',
    data:{
      method: 'delete',
      ...(options || {}),
    }
  });
}
